#ifndef MAIN_H_
#define MAIN_H_

typedef struct {
	FILE* FrontAvgPop; /* popolazione media al Front Server */
	FILE* DBAvgPop; /* popolazione media al DB Server    */
	FILE* FrontAvgUtil; /* utilizzazione media del Front Server */
	FILE* DBAvgUtil; /* utilizzazione media del DB Server */
	FILE* FrontAvgResTime; /* tempo medio di residenza al Front Server */
	FILE* DBAvgResTime; /* tempo medio di residenza al DB Server */
	FILE* SysAvgTHR; /* throughput medio del sistema */
	FILE* SysAvgRespTime; /* tempo medio di risposta del sistema */
	FILE* CompletedJobs; /* #job completati */
	FILE* DeniedJobs; /* #job sottoposti a feedback */
} data_files;

typedef struct {
	long indexDB;
	long rejected;
	double ResFTimeAvg;
	double ResDbTimeAvg;
	double RispTimeAvg;
	double DbPopAvg;
	double FPopAvg;
	double TroughputAvg;
	double utilizationF;
	double utilizationDB;
} collected_data;

void openFiles(data_files* files_struct);
void closeFiles(data_files* files_struct);
void writeDataToFile(data_files* files_struct, collected_data* data);
void printCollectedData(collected_data* data);
double Min(double a, double b);
double GetFrontArrival();
double GetFrontService();
double GetDBService();
int feedback(double p);

#endif /* MAIN_H_ */
